diagonalization of square matrices